<% include("../public/commonheader.html"){}%>
 <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">管理员管理</a>
            <a>
              <cite>角色管理</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
 </div>

<div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn" onclick="Sca.open('添加角色','${'/admin/roles/add',url}',800,600)"><i class="layui-icon"></i>添加角色</button>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-table layui-form">
                                <thead>
                                  <tr>
                                    <th width="64">
                                      ID
                                    </th>
                                    <th>${L.caption}</th><th>${L.operation}</th>
								  </tr>
                                </thead>
                                <tbody>
								<%for(list in lists){%>
                                  <tr>
                                    <td>${list.role_id!0}</td>
                                    <td>${list.caption!}</td>
                                    <td class="td-manage">
                                        <a title="编辑"  onclick="Sca.open('编辑','${'/admin/roles/edit/role_id/'+list.role_id,url}',800,600)" href="javascript:;">
                                        <i class="layui-icon">&#xe642;</i>
                                      </a>
                                      <a title="删除" onclick="role_del(this,'${list.role_id!0}')" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i>
                                      </a>
                                    </td>
                                  </tr>
								  <%}%>
                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                  <a href="${'/admin/roles/index/page/1',url}">${L.firstpage}</a> 
                                   <%for(var i=pageinfo.s;i<=pageinfo.e;i++){
									  if(i==pageinfo.page){
									%>
									 <span class="current">${i}</span>
								     <%}else{%>
                                     <a href="${'/admin/roles/index/page/'+i,url}">${i}</a> 
                                   <%}}%>
                                  <a href="${'/admin/roles/index/page/'+pageinfo.pages,url}">${L.lastpage}</a> 
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
<% include("../public/commonfooter.html"){}%>
<script type="text/javascript">
      layui.use(['laydate','form'], function(){
	    $ = layui.jquery;
        var laydate = layui.laydate;
        var  form = layui.form;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });


      });

/*用户-删除*/
      function role_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
          $.post(jkas.url("/admin/roles/drop"),{role_id:id},function(result)
			  {  if(200==result.code)
			     {
				  $(obj).parents("tr").remove();
                  layer.msg('已删除!',{icon:1,time:1000});
				  }
				  else
				  {layer.msg('删除出错!',{icon:5,time:1000});
				  }
			  },"json");
              
          });
      }

</script>